using System;
using System.Collections.Generic;
using System.Text;

namespace Colman.Rpg.Messaging
{
    /// <summary>
    /// Represents the base response message sent from the server.
    /// </summary>
    [Serializable]
    public abstract class ResponseMessage
    {
        /// <summary>
        /// Creates a new instance of <see cref="ResponseMessage" />.
        /// </summary>
        /// <param name="destination">The destination of the response.</param>
        protected ResponseMessage(ResponseDestination destination)
        {
            this.destination = destination;
        }

        /// <summary>
        /// Creates a new instance of <see cref="ResponseMessage" />.
        /// </summary>
        /// <param name="destinationUsers">The users this response is meant to go to.</param>
        protected ResponseMessage(IEnumerable<Player> destinationUsers)
            : this(ResponseDestination.Manual)
        {
            this.destinationUsers.AddRange(destinationUsers);
        }

        #region Destination Destination { get; set; } (destination)
        private ResponseDestination destination;

        /// <summary>
        /// Gets or sets the destination of the response.
        /// </summary>
        public ResponseDestination Destination
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.destination;
            }
            [System.Diagnostics.DebuggerStepThrough]
            set
            {
                if (this.destination != value)
                {
                    this.destination = value;
                }
            }
        }
        #endregion

        #region List<Player> DestinationUsers { get; set; } (destinationusers)
        private List<Player> destinationUsers = new List<Player>();

        /// <summary>
        /// Gets or sets the destinationUsers of the response.
        /// </summary>
        public List<Player> DestinationUsers
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.destinationUsers;
            }
        }
        #endregion
    }
}
